package com.test.ioc.controller;

import com.test.ioc.model.DBType;
import com.test.ioc.model.Student;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RequestMapping("yml")
@RestController
public class ReadymlController {
    @Value("${mykey}")
    private String key;
    @Value(("${server.port}"))
    private String port;
    @RequestMapping("/readyml")
    public String readYml(){
        return "从yml中获取配置文件"+key;
    }
    @RequestMapping("/readyml2")
    public String readYml2(){
        return "从yml中获取配置文件"+port;
    }
    @Autowired
    private Student student;
    @RequestMapping("/readStudent")
    public String readStudent(){
        return "从yml中获取配置文件Student"+student;
    }
    @Autowired
    private DBType dbType;
    @RequestMapping("/readDbType")
    public String readDBType(){
        return "从yml中获取配置文件Student"+dbType;
    }


}
